package com.oa.modules.approvalsec1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oa.modules.approvalsec1.dao.MattersDao;
import com.oa.modules.approvalsec1.entity.MattersEntity;
import com.oa.modules.approvalsec1.service.MattersService;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: Hankaicheng
 * @Date: 2022/5/5 14:19
 */
@Service
@Log4j2
public class MattersServiceImpl extends ServiceImpl<MattersDao, MattersEntity> implements MattersService {

    @Override
    public List<String> getItemsByIdStr(String id) {
        List<String> list = Arrays.asList(id.split(","));
        List<MattersEntity> mattersList = baseMapper.selectList(new QueryWrapper<MattersEntity>().in("id", list));
        List<String> matterNameList = mattersList.stream().map(e -> e.getName()).collect(Collectors.toList());
        matterNameList.removeIf("其他"::equals);
        return matterNameList;
    }
}
